<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAdminBillsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_bills', function (Blueprint $table) {
            $table->unsignedBigInteger('id')->primary();
            $table->unsignedBigInteger('user_id')->default(0)->comment('用户ID')->index('user');
            $table->unsignedBigInteger('fee')->default(0)->comment('操作金额(分)');
            $table->unsignedBigInteger('origin_order_id')->default(0)->comment('原始订单id');
            $table->enum('type',['OUTPUT','INPUT'])->default('INPUT')->comment('INPUT收入OUTPUT支出');
            $table->enum('channel',['WECHAT','ALIPAY','CASH'])->default('WECHAT')->comment('WECHAT微信ALIPAY支付宝CASH现金');
            $table->string('remark')->nullable()->default('')->comment('备注');
            $table->timestamps();
            $table->softDeletes();
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_unicode_ci';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_bills');
    }
}
